package com.examiner.dao;

import com.examiner.bean.Job;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface JobDao extends JpaRepository<Job,Integer>, JpaSpecificationExecutor<Job> {

    Job findByUserName(String userName);

    /**
     * 根据sid和superior下级职位
     * @param id
     * @param userName
     * @return
     */
    List<Job> findBySidAndStype(Integer id, String userName);

    Job findBySid(int i);

    @Query(value = "select * from job where sid=?1", nativeQuery = true)
    List<Job> findListBySid(Integer sid);

    @Query(value = "select id from job where user_name like %?1% and user_name != '部门和职位管理' ", nativeQuery = true)
    List<Integer> findIdByQuery(String query);
}
